package com.lzg.okrx.adapter

import com.lzg.okrx.observable.CallEnqueueObservable
import com.lzg.okrx.observable.CallExecuteObservable
import com.lzy.okgo.adapter.AdapterParam
import com.lzy.okgo.adapter.Call
import com.lzy.okgo.model.Response
import io.reactivex.Observable

internal object AnalysisParams {

    fun <T> analysis(call: Call<T>, param: AdapterParam?): Observable<Response<T>> {
        val params = param ?: AdapterParam()
        return if (params.isAsync) CallEnqueueObservable(call) //异步（默认）
        else CallExecuteObservable(call)                       //同步
    }

}
